package event

import (
	"time"

	"mini-admin/internal/model/event/topic"
)

// TicketSubscribedEvent 扫带参数二维码关注事件
type TicketSubscribedEvent struct {
	Ticket    string `json:"ticket,omitempty"`
	OpenID    string `json:"open_id,omitempty"`
	UnionID   string `json:"union_id,omitempty"`
	Nickname  string `json:"nickname,omitempty"`
	Avatar    string `json:"avatar,omitempty"`
	Timestamp int64  `json:"timestamp,omitempty"`
}

// Topic 事件名称
func (e TicketSubscribedEvent) Topic() string {
	return topic.TicketSubscribed
}

// NewTicketSubscribedEvent 新建扫带参数二维码关注事件
func NewTicketSubscribedEvent(qrSceneStr, openID, unionID, nickname, avatar string) *TicketSubscribedEvent {
	return &TicketSubscribedEvent{
		Ticket:    qrSceneStr,
		OpenID:    openID,
		UnionID:   unionID,
		Nickname:  nickname,
		Avatar:    avatar,
		Timestamp: time.Now().Unix(),
	}
}

// BytedanceMiniAppCreated 字节小程序应用已创建
type BytedanceMiniAppCreated struct {
	AppID     string `json:"app_id"`
	Timestamp int64  `json:"timestamp,omitempty"`
}

// Topic 事件名称
func (e BytedanceMiniAppCreated) Topic() string {
	return topic.BytedanceMiniAppCreated
}
